Skip to content

mgmt: Add support for optional custom domain header on whitelisted endpoints#943

Merged
kailash-b merged 4 commits into
masterfrom
feat/SDK-8309-3
Mar 24, 2026
Merged

mgmt: Add support for optional custom domain header on whitelisted endpoints#943
kailash-b merged 4 commits into
masterfrom
feat/SDK-8309-3

Conversation

@kailash-b
Copy link
Copy Markdown
Contributor

@kailash-b kailash-b commented Mar 24, 2026

Changes

This PR adds support for an optional Auth0-Custom-Domain HTTP header on whitelisted Management API endpoints.

  • New CustomDomainHeader static class exposing the Auth0-Custom-Domain header name constant
  • New overloads of ManagementApiClient constructors accepting an optional customDomain parameter:
    • ManagementApiClient(string token, Uri baseUri, IManagementConnection managementConnection, string? customDomain)
    • ManagementApiClient(string token, string domain, IManagementConnection connection, string? customDomain)
  • New overload of HttpClientManagementConnection constructor accepting an optional customDomain parameter
  • When a customDomain is provided, the Auth0-Custom-Domain header is automatically included on requests to the following whitelisted endpoints only:
    • POST /api/v2/jobs/verification-email
    • POST /api/v2/tickets/email-verification
    • POST /api/v2/tickets/password-change
    • POST /api/v2/organizations/{id}/invitations
    • GET/POST /api/v2/users
    • GET /api/v2/users/{id}
    • POST /api/v2/guardian/enrollments/ticket
    • POST /api/v2/self-service-profiles/{id}/sso-ticket
  • The header is silently omitted on all non-whitelisted endpoints
  • AssemblyInfo.cs updated to expose internals to Auth0.Core.UnitTests for testability

Usage example:

// With domain string
var client = new ManagementApiClient(token, "tenant.auth0.com", customDomain: "login.example.com");

// With URI
var client = new ManagementApiClient(token, new Uri("https://tenant.auth0.com/api/v2"), customDomain: "login.example.com");

References

Testing

  • This change adds unit test coverage

  • This change adds integration test coverage

  • This change has been tested on the latest version of the platform/language or why not

Checklist

@kailash-b kailash-b requested a review from a team as a code owner March 24, 2026 08:05
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.11%. Comparing base (b361fe9) to head (2aa4aa0).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #943       +/-   ##
===========================================
+ Coverage   34.72%   80.11%   +45.39%     
===========================================
  Files         462      462               
  Lines        5979     6025       +46     
  Branches      283      291        +8     
===========================================
+ Hits         2076     4827     +2751     
+ Misses       3848     1105     -2743     
- Partials       55       93       +38     
Flag Coverage Δ
authIntTests 30.67% <46.00%> (-0.04%) ⬇️
mgmtIntTests 61.12% <54.00%> (?)
unittests 18.32% <94.00%> (+7.94%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/Auth0.ManagementApi/CustomDomainHeader.cs
Comment thread src/Auth0.ManagementApi/HttpClientManagementConnection.cs Outdated
Comment thread tests/Auth0.Core.UnitTests/HttpClientManagementConnectionTests.cs
Comment thread src/Auth0.ManagementApi/ManagementApiClient.cs
Comment thread src/Auth0.ManagementApi/HttpClientManagementConnection.cs
Comment thread tests/Auth0.Core.UnitTests/HttpClientManagementConnectionTests.cs Outdated
@kishore7snehil
Copy link
Copy Markdown

@kailash-b We can add a section in Readme about how to use this header.

@kailash-b
Copy link
Copy Markdown
Contributor Author

@kailash-b We can add a section in Readme about how to use this header.

Updated the Examples section.

Comment thread src/Auth0.ManagementApi/ManagementApiClient.cs
Copy link
Copy Markdown

@kishore7snehil kishore7snehil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kailash-b kailash-b merged commit d893e05 into master Mar 24, 2026
8 checks passed
@kailash-b kailash-b deleted the feat/SDK-8309-3 branch March 24, 2026 12:33
@kailash-b kailash-b changed the title Add support for optional custom domain header on whitelisted endpoints mgmt: Add support for optional custom domain header on whitelisted endpoints Mar 26, 2026
@kailash-b kailash-b mentioned this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants